package com.mrfechetto.gene;

import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;

import com.mrfechetto.utils.Configuration;
import com.mrfechetto.utils.ListenerFactory;

public class GeneView extends JFrame
{
   private static final long serialVersionUID = 1L;
   
   JMenuBar menuBar;
   JMenu file, decks; // main menu items
   JMenuItem newGame, newGameGroup, close; // file

   public GeneView()
   {
      super();
      Container container = getContentPane();
      
      if("null".equals(Configuration.getProperty("comm.adapter")))
      {
      }

      setJMenuBar(createMenuBar());

      setSize(1160, 750);
      setVisible(true);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      addWindowListener(new WindowAdapter()
      {
         public void windowClosing(WindowEvent we)
         {
            
         }
      });
   }
   
   public JMenuBar createMenuBar()
   {
      menuBar = new JMenuBar();

      file = new JMenu("File");
      file.setMnemonic('f');

      decks = new JMenu("Decks");
      decks.setMnemonic('d');
      
      JMenu newMenu = new JMenu("New");
      newMenu.setMnemonic('n');
     
      newGame = new JMenuItem("New Game");
      newGame.addActionListener(ListenerFactory.actionPerformed(this, "newGameMenuItemClicked"));
      newGame.setMnemonic('g');

      newGameGroup = new JMenuItem("New Game (Change Group)");
      newGameGroup.addActionListener(ListenerFactory.actionPerformed(this, "newGameGroupMenuItemClicked"));
      newGameGroup.setMnemonic('r');

      close = new JMenuItem("Quit");
      close.addActionListener(ListenerFactory.actionPerformed(this, "close"));
      close.setMnemonic('q');

      newMenu.add(newGame);
      newMenu.add(newGameGroup);
      file.add(newMenu);
      file.add(decks);
      file.add(new JSeparator());
      file.add(close);
      menuBar.add(file);

      return menuBar;
   }
   

}
